package com.czt.mail.service;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.CountDownLatch;

/**
 * @author czt
 * @version 1.0
 * {@desc}
 * @date 2024/8/19 14:41
 */
@Service
public class AsyncServiceImpl implements AsyncService{

    @Override
    @Async("ioThreadPoolTaskExecutor")
    public void executorAsync(List<String> list, UserService userService, CountDownLatch countDownLatch) {
        try {
            userService.addBatch(list);
        }finally {
            countDownLatch.countDown();
        }
    }
}
